package com.raymond.service;

import com.raymond.entity.commons.BasisOrganizationPageQueryReqVo;
import com.raymond.entity.commons.PageResponse;
import com.raymond.entity.commons.OrganizationPageResponse;
import com.raymond.mapper.commons.BasisOrganizationMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * desc-组织 服务层实现
 *
 * @author houmenghe
 * @date 2025/04/28 10:57
 **/
@Service
@Slf4j
public class BasisOrganizationService {
    
    @Autowired
    private BasisOrganizationMapper basisOrganizationMapper;

    public PageResponse<OrganizationPageResponse> queryOrganizationList(BasisOrganizationPageQueryReqVo query) {
        PageResponse<OrganizationPageResponse> pageResponse = PageResponse.create(query);
        pageResponse.setDatas(basisOrganizationMapper.selectOrganizationList(query));
        if (query.isQueryTotal()) {
            pageResponse.setTotal(basisOrganizationMapper.selectOrganizationListCount(query));
        }
        return pageResponse;
    }
}
